Round (x), Round (x, #places)

Basic and Crystal syntax.

Arguments
Returns

Fractional Number

Action

Round rounds to the nearest whole number if the #places argument is excluded. If the value to the right of the decimal point is .499 or below, the program rounds to the next lowest number. If the value to the right of the decimal point is .5 or above, it rounds to the next highest number.

If the #places argument is used, the value in x is rounded to the nearest decimal place indicated by #places. Specifying #places as 0 works identical to leaving the #places argument off. You can also specify a negative number for #places; the number will be rounded to the nearest tenth (.1), hundredth (.01), or thousandth (.001), and so on.

Typical uses

Use Round any time rounding off a value to a particular decimal place is more appropriate than using the original value.

Examples

The following examples are applicable to both Basic and Crystal syntax, although Fix is preferred in the latter:

Round(1.23456)

Returns 1.

Round(1.499)

Returns 1.

Round(1.5000)

Returns 2.

Round(2345.23456,4)

Returns 2345.2346.

Round(2345.23456,3)

Returns 2345.235.

Round(2345.23456,2)

Returns 2345.23.

Round(2345.23456,0)

Returns 2345.

Round(2345.23456,-1)

Returns 2350.

Round(2345.23456,-2)

Returns 2300.

Round(2345.23456,-3)

Returns 2000.

Round(1.234499,3)

Returns 1.234.

Round(1.234500,3)

Returns 1.235.

Round({file.AMOUNT},1)

Returns 1854.5 where Amount = 1854.49.

Round({file.AMOUNT})

Returns 1854.00 where Amount = 1854.49.

Round({file.AMOUNT})

Returns 1855.00 where Amount = 1854.51.

Round({file.WEIGHT} / 100)

Returns 4 where Weight = 424.

Round({file.WEIGHT} / 100)

Returns 5 where Weight = 451.

Round((A * B) / C)

Returns 11 where A = 25, B = 3, and C = 7.

Round(file.AMOUNT,1)

Returns 1854.5 where Amount = 1854.51.

Round({file.WAGE} * {file.HOURS WORKED}, 2)

Returns $146.63 where Wage = $5.75 and Hours worked = 25.5.

Comments

Rounding is also a feature available as a formatting option for numerical values in fields.

Be aware that using field formatting features may affect how values are used in formulas. See ToNumber (numeric), ToNumber (string), ToNumber (Boolean) and the To currency operator.

Related topics

Truncate (x), Truncate (x, #places)

Fix

Int (number)

Formula 8



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com